<template>
	<view class="content">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<template #top>
				<view class="search-container">
					<uv-search placeholder="请输入搜索内容" v-model="keyword" @search="getList()" @custom="getList()" shape="square" searchIconSize="26" :actionStyle="searchClass"></uv-search>
				</view>
			</template>
			<view class="con_box" v-for="(item,index) in dataList" :key="item.id">
				<view class="text_con">
					<view class="title">
						<view class="titleText">{{item.patientName}}</view>
					</view>
					
					<view class="button">
						<view class="smallButton">
							<button class="cu-btn round sm bg-blue" @click.stop="gotoAdd('',item.id)">发起随访</button>
						</view>
						<view class="desc">
							 科室：{{item.patientDepartment}} 病种：{{item.patientType}} 
						</view>
					
					</view>
				</view>
			</view>
		</z-paging>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				dataList: [],
				keyword:"",
				searchClass:{
					    "font-size": "14px",
					    "background":"#0081ff",
					    "color": "#fff",
					    "padding": "10rpx",
					    "border-radius": "20rpx",
					    "display": "flex",
					    "align-items": "center",
					    "justify-content": "center"
				}
			}
		},
		async onLoad() {
		},
		onShow() {

		},
		onReady() {


		},
		methods: {
			getList(){
				this.$refs.paging.reload();
			},
			gotoAdd(id,patientId) {
				console.log(patientId)
				let url = "/pages/index/add/addByYiHu"+ "?id=" + id+"&patientId="+patientId
				uni.navigateTo({
					url: url
				})
			},
			queryList(pageNo, pageSize) {
				let params = {
					page: pageNo,
					limit: pageSize,
					key:this.keyword
				}
				this.$api.getPatientInfoList(params).then(res => {
					if (res.code == 0) {
						this.$refs.paging.complete(res.page.list);
					} else {
						this.$refs.paging.complete(false);
					}
				})
			}
		}
	}
</script>
<style lang="scss">
	.search-container{
		height: 100rpx;
		    background: #fff;
		    display: flex;
		    padding: 20rpx;
	}
	.con_box {
		display: flex;
		flex-direction: nowarp;
		height: 150rpx;
		margin: 20rpx 15rpx;
		padding: 10rpx;
		background-color: #fff;
		border-radius: 20rpx;

		.photo {
			width: 240rpx;
			height: 150rpx
		}

		.photo image {
			width: 240rpx;
			height: 150rpx
		}

		.text_con {
			flex: 1;
			margin-left: 30rpx;

			.title {
				display: flex;
				justify-content: space-between;
				font-size: 38rpx;
				margin-bottom: 26rpx;

				.titleText {
					font-weight: bold;
				}
			}

			.desc {
				width: 74%;
				    color: #a8a6a6;
				    height: 40rpx;
				    line-height: 40rpx;
				    overflow: hidden;
				    text-overflow: ellipsis;
				    display: -webkit-box;
				    -webkit-box-orient: vertical;
				    -webkit-line-clamp: 1;
			}
			.button {
				margin-top: 20rpx;
			
				.smallButton {
					display: flex;
					flex-direction: row;
			
					button {
						margin-right: 10rpx;
					}
				}
			
				.addtime {
					color: #a8a6a6;
					display: flex;
					flex-direction: column;
					justify-content: center;
				}
			
				display: flex;
				justify-content: space-between;
				flex-direction: row-reverse;
			}
		}


	}
</style>